package ink.sunflowerk.dao;


import ink.sunflowerk.entity.MyDirectory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MyDirectoryMapper {

     int addOne(MyDirectory myDirectory);

     @Delete("delete from tab_my_directory where did=#{did}")
     int deleteOne(int did);
     //"0-1-2"  dfu以0-1-2开头
      //0-1-2   0-1-2-
     @Delete("delete from tab_my_directory where dfu=#{dfu} or dfu like concat(#{dfu},'-%')")
     int deleteZis(String dfu);

     int updateOne(MyDirectory myDirectory);

     @Select("select * from tab_my_directory where did=#{did}")
     MyDirectory getOneByDid(int did);

    @Select("select * from tab_my_directory where dname=#{dname} and dfu=#{dfu} and uid=#{uid} limit 0,1")
    MyDirectory getOneByDname(@Param("dname") String dname, @Param("dfu")String dfu, @Param("uid") int uid);

    @Select("select * from tab_my_directory where dfu=#{dfu}  and uid=#{uid}")
    List<MyDirectory> getAllByDfu(@Param("dfu") String dfu, @Param("uid") int uid);
}
